package com.lxl.xm.mapper;

import com.lxl.xm.model.entity.AdContent;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lxl.xm.model.entity.AdContent;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lxl.xm.model.entity.Advertiser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
* @author 86135
* @description 针对表【ad_content(广告内容表)】的数据库操作Mapper
* @createDate 2024-01-31 16:32:41
* @Entity com.lxl.model.entity.AdContent
*/
@Mapper
public interface AdContentMapper extends BaseMapper<AdContent>{
    @Select("select keyword,count(*) as search_count"
            +"from ad_content"
            +"where submit_date between #{startDate} and #{enddate}"
            +"and approval_status = 1"
            +"group by keyword"
            +"order by search_count desc")
    List<Map<String,Object>> getKeywordSearchStatistics(String startDate, String endDate);
    Page<AdContent> selectAdContentPage(Page<?>page);

    @Select("SELECT count(id) FROM `ad_content`")
    Integer getCountofADs();

    @Select("select count(id)count from `ad_content` where TO_DAYS(submit_date) = to_days(now());")
    Integer getCountOfApply();
}




